import { AuthService } from './auth.service';
import { BaseService } from './base.service';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { StorageService } from './storage.service';
import { UserInfo } from '../model/userInfo';

@Injectable({
  providedIn: 'root',
})
export class UserInfoService extends BaseService {
  public constructor(http: HttpClient, private storageService: StorageService, private authService: AuthService) {
    super(http);
  }
  public getUserInfo(): Observable<UserInfo> {
    return this.get<UserInfo>('/sentences/userExtend');
  }
  public updateUserInfo(currentChapterNo: number, currentSequenceNo: number, waitTime: number, autoPlaying: boolean) {
    return this.post('/sentences/userExtend', {
      currentChapterNo,
      currentSequenceNo,
      waitTime,
      autoPlaying,
    });
  }
}
